﻿@using Resource.Models.Web
@using lang = Resource.Web;
@model Yqblog.ViewModels.UCenterViewModel
@{
    ViewBag.Title = lang.UserCenter;
}
<h2 class="utitle">@Model.UserInfo.UserName</h2>
<div class="usercenterWrap">
    <div class="tabbable tabs-left">
        <ul class="nav nav-tabs">
            <li class="active"><a data-toggle="tab" href="#userinfo">@lang.BasicInformation</a></li>
            <li class=""><a data-toggle="tab" href="#useravatar">@lang.UploadAvatar</a></li>
            <li class=""><a data-toggle="tab" id="liusermodify" href="#userprofile">@lang.ModifyInformation</a></li>
            <li class=""><a data-toggle="tab" href="#userchangepassword">@lang.ChangePassword</a></li>
            <li class=""><a data-toggle="tab" href="#usercomment">@lang.MyComments</a></li>
            <li class=""><a data-toggle="tab" href="#usernote">@lang.MyMessages</a></li>
        </ul>
        <div class="tab-content usercenter">
            <div id="userinfo" class="tab-pane active"> 
                @{Html.RenderPartial("_UserInfo", Model.UserInfo);}
                <a class="modifyuserinfo">@lang.ModifyUserInfo</a>
            </div>
            <div id="useravatar" class="tab-pane">
                @{Html.RenderPartial("_UserAvatar", Model);}
            </div>
            <div id="userprofile" class="tab-pane">
                @{Html.RenderPartial("_UserProfile", Model);}
            </div>
            <div id="userchangepassword" class="tab-pane">
                @{Html.RenderPartial("_ChangePassword");}
            </div>
            <div id="usercomment" class="tab-pane"> 
            </div>
            <div id="usernote" class="tab-pane">
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        GetUserComment(1);
        GetUserNote(1);
        RefreshAvatar('@Model.UserInfo.UserName');

        $('#usercomment').on('click', ".mycomment a", function() {
            GetUserComment($(this).attr("p"));
        });

        $('#usernote').on('click', ".mynote a", function() {
            GetUserNote($(this).attr("p"));
        });

        $("#Birth").datepicker(
            {
                changeMonth: true,
                changeYear: true
            });

        $('#userinfo').on('click', ".modifyuserinfo", function() {
            $('#liusermodify').trigger('click');
        });
    });

    function RefreshAvatar(id) {
        $('#uavatar').attr("src", '@(Model.Localhost)/upload/Avatar/upload/avatars/' + id + '/medium.jpg?random=1' + Math.random());
    }
</script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.10.3.min.js")" type="text/javascript"></script>
@if (Web.Lang == "" || Web.Lang == "zh-tw")
{
    <script src="@Url.Content("~/Scripts/jquery.ui.datepicker-zh-CN.js")" type="text/javascript"></script>
}

